var express = require('express');
var router = express.Router();
const { getOrders, addOrders, deleteOrders, getDetails } = require("../service/ordersService")

// 获取订单
router.get('/getOrders', async function (req, res, next) {
    const result = await getOrders(req.query)
    res.send(result);
});


// 新增订单
router.post('/addOrders', async function (req, res, next) {
    const result = await addOrders(req.body);
    res.send(result)
});

// 删除订单
router.post("/whetherDelete", async function (req, res, next) {

    const _id = req.body;
    res.send(await deleteOrders(_id));

});

// 查看详情
router.post("/getOrdersDetails", async function (req, res, next) {
    const { _id } = req.body;
    res.send(await getDetails({ _id }));
});
module.exports = router;
